package blockworld;

import grid.items.Body;

import java.awt.Point;
import java.util.Comparator;



class BestTargetCompPlacement implements Comparator<Placement>
{
	EBody _shooter = null;
	 
	public BestTargetCompPlacement(EBody shooter)
	{
		this._shooter = shooter;
	}
	
	@Override
    public int compare(Placement place1, Placement place2)
    {
    	EBody body1 = place1.getEBody();
    	EBody body2 = place2.getEBody();
		
    	//There are two things to compare too, the expected HP after shooting, and the expected damage.
    	if( body1.getExpectedHPAfterShoot(_shooter.getType()) < body2.getExpectedHPAfterShoot(_shooter.getType()) )
			return -1;
		else if( body1.getExpectedHPAfterShoot(_shooter.getType()) > body2.getExpectedHPAfterShoot(_shooter.getType()) )
			return 1;
		else  // same expectedHPAfterShoot
		{
			if( body1.getExpectedDamage(_shooter.getType()) > body2.getExpectedDamage(_shooter.getType()) )
				return -1;
			else if(body1.getExpectedDamage(_shooter.getType()) < body2.getExpectedDamage(_shooter.getType()))
				return 1;
			else
				return 0;
		}
    }

}


public class Placement
{
	private EBody _body;
	private Point _position;
	
	private Result _result;
	
	public Placement(EBody body, int x, int y)
	{
		_body = body;
		_position = new Point(x,y);
	}
	
	public Placement(EBody body, Point point)
	{
		_body = body;
		_position = point;
	}
	
	public EBody getEBody()
	{
		return _body;
	}
	
	public Point getPos()
	{
		return _position;
	}
	
	public void setPos(Point pos)
	{
		this._position = pos;
	}
	
	public int getX()
	{
		return _position.x;
	}
	
	public int getY()
	{
		return _position.y;
	}

	
	
	
}
